exports.ReceivedGiftMainView = UI.View.subclass(
{
    className: "ReceivedGiftMainView",
    initialize: function($super) 
    {
    	$super();
        this.setFrame([TCUtil.getAdjustedX(0),TCUtil.getAdjustedY(0),TCUtil.getAdjustedX(320),TCUtil.getAdjustedY(480)]);
        //GALocalizationHandler.getRelativeString(Core.Localization.getString("TZ_MESSAGE_OFFERS_COINS_BUCKS"),[totalCoinsDiff,totalBucksDiff]);     
    },
    
    createView: function()
    {
   		this.addBackground();
        this.addCloseBtn();
        this.addTopLabel();

		this.addTableView();
    },

   	addTableView: function()
   	{
		this._tableView = new ReceivedGiftGenericTableView(this);     
   		this.addChild(this._tableView);
   	},
   	
    addBackground: function()
    {
    	var backgroundImagePath = this.getBaseResourcePath() + "background.png";
		this._backgroundImage =  UIFactory.getImage([TCUtil.getAdjustedX(0),TCUtil.getAdjustedY(45),TCUtil.getAdjustedX(320),TCUtil.getAdjustedY(380)], backgroundImagePath); 
        this.addChild(this._backgroundImage);
    },
    
   addCloseBtn: function()
    {
    	var closeButtonNormalImagePath = this.getBaseResourcePath() + "close-button-normal.png";
    	var closeButtonSelectedImagePath = this.getBaseResourcePath() + "close-button-pressed.png";
    	
    	this._closeBtn = UIFactory.getGenericButton([TCUtil.getAdjustedX(260), TCUtil.getAdjustedY(50), TCUtil.getAdjustedY(40), TCUtil.getAdjustedX(40)], closeButtonNormalImagePath,closeButtonSelectedImagePath,null,null,null, this);	
		this.addChild(this._closeBtn);
		
		this._closeBtn.onclick = function()
    	{
    		MMSoundManager.playEffect(BUTTON_TAP_SOUND);
			this.removeFromParent();
			this.destroy();
   		}.bind(this);
    },
    
    addTopLabel: function()
    {
    	this._topLabel = UIFactory.getTextArea([TCUtil.getAdjustedX(100), TCUtil.getAdjustedY(55), TCUtil.getAdjustedX(120), TCUtil.getAdjustedY(45)], Core.Localization.getString("GIFTS"), TCUtil.getAdjustedFontSize(70), UI.ViewGeometry.Gravity.Center);
	   	this.addChild(this._topLabel);
    },
    
    addEmptyLabel: function()
    {
    	this._emptyLabel = UIFactory.getTextArea([TCUtil.getAdjustedX(90), TCUtil.getAdjustedY(150), TCUtil.getAdjustedX(150), TCUtil.getAdjustedY(150)], Core.Localization.getString("NO_GIFTS_AVALIABLE"), TCUtil.getAdjustedFontSize(120), UI.ViewGeometry.Gravity.Center);
	   	this.addChild(this._emptyLabel);
    },
    	
	getBaseResourcePath: function()
	{
		return "./Content/images/gamelayer/controllayer/gifttableview/";
	},

    destroy: function()
    {
    	if(this._tableView)
    	{
			this._tableView.destroy();
    		this._tableView = null;
    	}
    	if(this._backgroundImage)
    	{
    		this._backgroundImage.destroy();
    		this._backgroundImage = null;
    	}
    	if(this._closeBtn)
    	{
    		this._closeBtn.destroy();
    		this._closeBtn = null;
    	}
    	if(this._topLabel)
    	{
    		this._topLabel.destroy();
    		this._topLabel = null;
    	}
    	if(this._emptyLabel)
    	{
    		this._emptyLabel.destroy();
    		this._emptyLabel = null;
    	}
    },
});
